'use strict';
import React from "react";
import {Image, Text, TouchableOpacity, View} from "react-native";
import chjStyle from "../../CustomStyle";

export default class ModuleMainUIFooter extends React.Component {
    constructor(props) {
        super(props);
        this.state = {selected: 0};
    }

    // 渲染时调用
    render() {
        return (
            <View style={[chjStyle.mainUIFooter]}>
            </View>
        );
    }

    renderButton(onPress, title, img, i) {
        return (
            <TouchableOpacity
                underlayColor='#303030'
                style={{
                    position: 'absolute',
                    top: 0,
                    left: chjStyle.getActualSizeInHorizontal(187.5 * i),
                    width: chjStyle.getActualSizeInHorizontal(187.5),
                    height: chjStyle.footerHeight
                }}
                onPress={() => {
                    if (onPress)
                        onPress();
                }}>
                <Image style={{
                    position: 'absolute',
                    top: chjStyle.getActualSizeInVertical(20),
                    left: chjStyle.getActualSizeInHorizontal(64),
                    width: chjStyle.getActualSizeInHorizontal(53),
                    height: chjStyle.getActualSizeInVertical(44)
                }}
                       source={img} resizeMode='contain'/>
                <Text style={[chjStyle.baseText, {
                    position: 'absolute',
                    backgroundColor: 'rgba(0,0,0,0)',
                    top: chjStyle.getActualSizeInVertical(72),
                    width: chjStyle.getActualSizeInHorizontal(187.5),
                    textAlign: 'center',
                    fontSize: chjStyle.getActualFontSize(26),
                    color: this.state.selected === i ? '#f91' : '#666'
                }]}>{title}</Text>
            </TouchableOpacity>);
    }
}
